//Header file definition for 3 component colors
//R,G,B
//1 byte each

#ifndef __COLOR3_H__
#define __COLOR3_H__

#include<fstream>

//Forward declaration
//Utility function and structure
//Scaled RGB components clamped at [0-255]
struct RGB255
{
	unsigned char r,g,b;
};


//3 component colors
class Color3
{
public:
	float r,g,b;

	//constructors
	Color3();
	Color3(float a, float b, float c);
	
	//Functions
	
	//Gamma correct
	void GammaCorrect(float gamma);

	//overloaded operators
	Color3 operator - ();

	//binary operators
	Color3 operator + (Color3& C);
	Color3 operator - (Color3& C);
	Color3 operator * (Color3& C);
	Color3 operator * (float k);
	friend Color3 operator * (float k, Color3& C) { return Color3(k*C.r, k*C.g, k*C.b); }
	Color3 operator / (float k);
	Color3 operator / (Color3& C);

	//Inbuilt misc function
	//This function returns the RGB255 structure of itself
	RGB255 GetRGB255();

	//output operators
	friend void operator << (std::ostream& output, Color3& C)
	{
		output<<C.r<<C.g<<C.b;
	}

};



//Function to convert floating point color values to scaled clamped values
RGB255 Color3Byte(const Color3& C);

#endif